//
//  BaseController.m
//  HarmonizePub
//
//  Created by rzhy on 2016/10/31.
//  Copyright © 2016年 Zy. All rights reserved.
//

#import "BaseController.h"
#import "UIBarButtonItem+Zy.h"

@interface BaseController ()

@end

@implementation BaseController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.edgesForExtendedLayout = UIRectEdgeNone;
    UIBarButtonItem *leftItem = [UIBarButtonItem barButtonItemWithIcon:@"Back.png" highlightedIcon:nil target:self action:@selector(back)];
    UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    nagetiveSpacer.width = -15;
    self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
    if (self.navigationController.childViewControllers.count > 2)
        self.navigationItem.rightBarButtonItem = [UIBarButtonItem barButtonItemWithIcon:@"ReturnHomeButton.png" highlightedIcon:nil target:self action:@selector(returnHome)];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)back {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)returnHome {
    [self.navigationController popToRootViewControllerAnimated:YES];
}

@end
